package org.ovirt.microvirt.services.pool;

import java.util.List;

import org.ovirt.microvirt.beans.VirtualMachinePool;
import org.ovirt.microvirt.services.PoolService;
import org.springframework.orm.jpa.support.JpaDaoSupport;

public class PoolServiceImpl extends JpaDaoSupport implements PoolService {

	@SuppressWarnings("unchecked")
	@Override
	public List<VirtualMachinePool> list() {
		return getJpaTemplate().find(
				"select a from " + VirtualMachinePool.class.getName() + " a");
	}

	@Override
	public VirtualMachinePool getById(String key) {
		return getJpaTemplate().find(VirtualMachinePool.class, key);
	}

	@Override
	public VirtualMachinePool persist(VirtualMachinePool pool) {
		getJpaTemplate().persist(pool);
		return pool;
	}

}
